package cn.com.code.hwjs;

import java.util.Scanner;

/**
 * HJ29 字符串加解密
 * @author zhengpei
 * https://www.nowcoder.com/practice/2aa32b378a024755a3f251e75cbf233a?tpId=37&tqId=21252&rp=1&ru=/exam/oj/ta&qru=/exam/oj/ta&sourceUrl=%2Fexam%2Foj%2Fta%3Fdifficulty%3D3%26page%3D1%26pageSize%3D50%26search%3D%26tpId%3D37%26type%3D37&difficulty=3&judgeStatus=undefined&tags=&title=
 * @date 2022/4/23
 */
public class Hwjs29 {

  public static void main(String[] args) {
    Scanner sc1 = new Scanner(System.in);
    System.out.println(encode(sc1.nextLine()));
    System.out.println(decode(sc1.nextLine()));
  }

  private static String encode(String str) {
    char[] chars = str.toCharArray();
    for (int i = 0; i < chars.length; i++) {
      // 数字 1-9
      if (chars[i] >= '0' && chars[i] <= '8') {
        chars[i] = (char) (chars[i] + 1);
      } else if (chars[i] == '9') {
        chars[i] = '0';
      } else if (chars[i] >= 'A' && chars[i] < 'Z') {
        chars[i] = (char) (chars[i] - 'A' + 'a' + 1);
      } else if (chars[i] == 'Z') {
        chars[i] = 'a';
      } else if (chars[i] >= 'a' && chars[i] < 'z') {
        chars[i] = (char) (chars[i] - 'a' + 'A' + 1);
      } else if (chars[i] == 'z') {
        chars[i] = 'A';
      }
    }
    return String.valueOf(chars);
  }

  private static String decode(String str) {
    char[] chars = str.toCharArray();
    for (int i = 0; i < chars.length; i++) {
      // 数字 1-9
      if (chars[i] >= '1' && chars[i] <= '9') {
        chars[i] = (char) (chars[i] - 1);
      } else if (chars[i] == '0') {
        chars[i] = '9';
      } else if (chars[i] > 'A' && chars[i] <= 'Z') {
        chars[i] = (char) (chars[i] - 'A' + 'a' - 1);
      } else if (chars[i] == 'A') {
        chars[i] = 'z';
      } else if (chars[i] > 'a' && chars[i] <= 'z') {
        chars[i] = (char) (chars[i] - 'a' + 'A' - 1);
      } else if (chars[i] == 'a') {
        chars[i] = 'Z';
      }
    }
    return String.valueOf(chars);
  }

}
